library(rgdal)
library(ggplot2)
library(ggridges)
library(treemap)
library(ggraph)
library(rmarkdown)
library(tidyverse)
library(dplyr)
library(lemon)
library(sf)
library(ggmap)
library(extrafont)
library(forcats)
library(treemapify)
p4v_2017 <- read_csv("p4v_2017.csv")
p4v_conflict <- read_csv("p4v_conflict.csv")
p4v_history <- read_csv("p4v_history.csv")
world_shp <- st_read("TM_WORLD_BORDERS-0.3.shp")
## Reading layer `TM_WORLD_BORDERS-0.3' from data source `/Users/yinzhantang/Desktop/DataVisz/Political-Regimes-and-Global-Conflict-master/TM_WORLD_BORDERS-0.3.shp' using driver `ESRI Shapefile'
## Simple feature collection with 246 features and 11 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -180 ymin: -90 xmax: 180 ymax: 83.6236
## epsg (SRID):    4326
## proj4string:    +proj=longlat +datum=WGS84 +no_defs
world <- read_csv("ged181.csv") %>% filter(year == 2017)

1. Introduction

Political regime is considered one of the most influential factors contributing to conflicts. For this matter, a commonly held belief is that democracy cause peace at least between democratic countries, while autocracy often leads to all kinds of conflicts due to aggressive diplomatic policies and political oppression. However, many evidence showed that the impact of political regime on social stability is not that simple. This class project is a great opportunity for me to further examine the topic and draw my own conclusion. Although many researches have been done on this issue, I still think a visual perception of it is both interesting and valuable.

my_custome_theme <- function(){theme(,
    plot.title = element_text(size = 25, face = "bold", hjust = 0.5, family = "Avenir",color = "#272727"),
    plot.subtitle = element_text(size = 20, family = "Avenir",hjust = 0.5, color = "#272727"),
    plot.caption = element_text(size = 18, hjust = 1, family = "Avenir", color = "#272727"), 
    axis.title.x = element_text(size = 18, face="bold", family = "Avenir",color = "#272727"), 
    axis.title.y = element_text(size = 18, face="bold", family = "Avenir",color = "#272727"),
    axis.text.x = element_text(size = 18, family = "Avenir",color = "#272727"),
    axis.text.y = element_text(size = 18, family = "Avenir",color = "#272727"),
    strip.text.x = element_text(size = 15, family = "Avenir",face="bold"),
    legend.text = element_text(size = 15, family = "Avenir",face = "bold", color = "#272727"),
    panel.background = element_rect(fill = "#ECECEC"),
    plot.background = element_rect(fill = "#ECECEC"),
    legend.key = element_rect(fill = "#ECECEC"),
    panel.grid.major = element_line(color = "#565656"),
    legend.background = element_rect(fill = "#ECECEC"),
    legend.title = element_text(size = 15, family = "Avenir",face = "bold", color = "#272727"))}

2. An Overview of World’s Political Status

Simple data visualization techniques enables us to have an intutive sense of world’s political status.

merged <- left_join(world_shp, p4v_2017, by = c("NAME" = "country"))
merged %>%
  mutate(polity2 = as.factor(polity2)) %>%
  mutate(polity2 = fct_collapse(polity2, 
                                  'Highly Autocrative' = c('-10', '-9', '-8', '-7', '-6'),
                                  'Autocrative' = c('-5', '-4', '-3', '-2', '-1'),
                                  'Neutral' = '0',
                                  'Democratic' = c('1', '2', '3', '4', '5'),
                                  'Highly Democratic' = c('6', '7', '8', '9', '10'))) %>%
ggplot() + geom_sf(aes(fill = polity2)) +
my_custome_theme() +
    scale_fill_manual("Political Regimes",
                    values = c("Highly Autocrative" = "#F78888", 
                               "Autocrative" = "#F3D250",
                               "Neutral" = "#FFFFFF",
                               "Democratic" = "#90CCF4",
                               "Highly Democratic" = "#5DA2D5")) +
  labs(x = NULL, 
       y = NULL, 
       title = "Political Status Distribution 2017",
       subtitle = "A total of 34 countries have autocratic political regimes, mostly in Asia and Africa. ",
       fill = "Political Regimes",
        caption = "Source: Center for Systemic Peace")

This graph shows that in 2017 there are more democratic countries (with postive Polity2 scores) than autocratic countres (with negative Polity2 scores) in the world (the ratio is approximately 2:1). Almost all autocratic countries concentrate in Asia and Africa.

Looking back to the history, the world is also becoming more and more democratic, as the graph below shows.

year_average <- p4v_history %>% 
  group_by(year) %>% 
  summarise(mean = mean(polity2, na.rm = TRUE))

p4v_history %>%
  group_by(year,region) %>%
  summarise(mean = mean(polity2, na.rm = TRUE)) %>% 
  ggplot(aes(x = year, y = mean)) + 
  annotate(geom = "rect", xmin = min(1921), xmax = max(1941), ymin = -Inf, ymax = Inf, fill = "grey", alpha = 0.4) + 
  annotate(geom = "rect", xmin = min(1947), xmax = max(1991), ymin = -Inf, ymax = Inf, fill = "grey", alpha = 0.4)  +
  scale_x_continuous(name = "Year (1800 - 2017)", 
                     breaks = c(1800, 1921, 1941, 1947, 1991),
                     labels = c(1800, 1921, 1941, 1947, 1991), trans = "log") +
  geom_step(alpha = 0.6, aes(color = region), size = 2) + 
  geom_line(data = year_average, aes(x = year, y = mean), color = "#272727", size = 2) +
  labs(title = "A Historical Look of World's Political Status", 
       subtitle = "The world has been becoming more democratic despite some fluctuations.",
       x = "Year(1800 - 2012)",
       y = "Political Status  (Average Polity2 Scores)", 
       caption = "Source: Polity2 Index (1800 - 2012)",
       color = "Regions") +
  annotate("text", x = 2025, y = 5, label = "World", size = 8, color = "#272727") + 
  annotate("text", x = 1930, y = -8, label = "Post-War \n Recession",color = "#272727", size = 6) +
  annotate("text", x = 1967, y = -8, label = "Cold War",color = "#272727", size = 6) + 
  my_custome_theme() + 
  theme(axis.text.x = element_text(size = 20, angle = 45),
        axis.title.x = element_text(size = 20),
        axis.title.y = element_text(size = 20),
        plot.title = element_text(size = 30),
        plot.subtitle = element_text(size = 25),
        axis.text.y = element_text(size = 20)) + 
  scale_color_manual("Regions",
                    values = c("Africa" = "#FF652F", 
                               "Asia" = "#FFE400",
                               "Central and South America" = "#14A76C",
                               "Europe and North America" = "#4056A1", 
                               "Oceania (Island States)" = "#DA7893")) +
  guides(color = guide_legend(override.aes=list(size=4)),
         size = guide_legend(override.aes = list(color = "#272727")))

This graph intuitively shows the evolution and development of political status in the past 217 years. The first modern democratic states were born in the industrial revolution. Along with the economic development, revolutions and reforms took place in many countries (mainly in Europe), bringing constitutions and elecotrial democracy. The number of democratic states continually increased until the World War I, after which many countries stepped back and gave dictators power because of the economy recession. During the Cold War, the world’s democracy status deterioated again as Soviet Union expanded its global influence. After the USSR collapsed in 1991, many countries democratized, resulting in a sharp incrase in world’s average democracy status.

p4v_2017 %>%
  ggplot(aes(x = polity2, y = gdp_per_capita)) +
  geom_jitter(aes(label = country, color = region, size = pop, face = "bold")) + 
  geom_vline(xintercept = 0, color = "#565656") +
  scale_size("Population", breaks = c(0,10000000, 20000000, 40000000,60000000,
                                      100000000, 300000000, 1000000000), 
                           labels = c("< 10 Million","10 Million - 20 Million",
                                      "20 Million - 40 Million", "40 Million - 60 Million",
                                      "60 Million - 100 Million", "100 Million - 300 Million",
                                      "300 Million - 1 Billion", "> 1 Billion"),
             range = c(3,15)) +   
  scale_x_continuous(breaks = c(-10, -5, 0 , 5, 10),
                    labels = c("Highly Autocrative", "Autocrative", "Neutral", "Democratic" ,"Highly Democratic")) +
  geom_smooth(formula = 'y ~ x', method = 'loess') + 
  labs(title = "Political Regimes and Economic Performance", 
       subtitle = "In developing world, democratic states are not weathier than autocratic states.",
       x = "Political Status (Polity2 Index)", 
       y = "GDP per capita (log2)", 
       caption = "Source: Polity2 Index, World Bank", color = "Regions") + 
  scale_y_continuous(trans = "log2", labels = scales::dollar) +
my_custome_theme() +
  scale_color_manual("Regions",
                    values = c("Africa" = "#FF652F", 
                               "Asia" = "#F9CF00",
                               "Central and South America" = "#14A76C",
                               "Europe and North America" = "#4056A1", 
                               "Oceania (Island States)" = "#DA7893")) +
  guides(color = guide_legend(override.aes=list(size=4)),
         size = guide_legend(override.aes = list(color = "#272727")))

If ruling developed countries out of analysis, the democratic countries as a whole don’t have better economic wellbeings than autocratic countries as expected. Some autocratic states have noticeable economic performance. China, which scores -7 in Polity2 Index, is the second-largest economy in the world and has a GDP per capita closed to $10000, almost 5 times the size of India, its democratic counterpart. Some Arabia States like Barlin, Saudi Arabia and United Arab Emirates have rich oil reserves, making them the world’s most dictated states and richest states in the meantime.

3. Political Schemes and Conflicts

Similar data visualization techniques could also help us examine the relation between political schemes and conflicts. In the following analysis, I would use “Conflict Magnitude”, a score on the intensity level of each conflict episode, to measure general conflict conditions in different scenarios.

p4v_int <- 
  p4v_conflict %>%
  filter(inttot > 0) %>%
  mutate(conflict = inttot,
         type = "International") %>%
  subset(select = c(year, country, polity2, region, politic, conflict, type, muslim))

p4v_civ <-   
  p4v_conflict %>%
  filter(civtot > 0) %>%
  mutate(conflict = civtot,
         type = "Civil") %>%
  subset(select = c(year, country, polity2, region, politic, conflict, type, muslim))

p4v_type <- rbind(p4v_int, p4v_civ)

p4v_type %>%
  mutate(status = ifelse(polity2 > 0, "Democratic Areas", "Autocratic Areas")) %>%
  group_by(year, status, type) %>%
  summarise(total = sum(conflict),
            count = n()) %>%
  ggplot(aes(x = year, y = total)) + 
  annotate(geom = "rect", xmin = -Inf, xmax = max(1991), 
           ymin = 0, ymax = Inf, fill = "grey", alpha = 0.4) +
  geom_area(aes(fill = type), position = 'stack') + 
  scale_x_continuous(expand = c(0,0)) +
  geom_vline(xintercept = 1991, alpha = 0.8, color = "black", linetype = "longdash") + 
  facet_grid(~status) + 
  labs(title = "Post-War Conflict Meganitudes in Autocratic / Democratic Areas", 
       subtitle = "Democratic States tend to have less conflicts (especially civil conflicts).",
       x = "Year (1946 - 2012) ", 
       y = "Total Conflict Magnitudes", 
       caption = "Source: Center for Systemic Peace",
       fill = "Conflict Type") +
  annotate("text", x = 1953, y = 67, label = "Cold War", size = 6, color = "#272727") +
  annotate("text", x = 2008, y = 67, label = "After", size = 6, color = "#272727")  + 
  my_custome_theme()+
  scale_fill_manual("Conflict Type",
                    values = c("Civil" = "#F3D250", 
                               "International" = "#F78888")) +
  guides(color = guide_legend(override.aes=list(size=4)),
         size = guide_legend(override.aes = list(color = "#D7CEC7")))

This graph indicates that in general, after World War II, conflicts in autocratic areas significantly outnumber conflicts in democratic areas. In both areas, civil conflicts constituded the majority of violent conflicts (approximately 80%). However, both civil and international conflicts decrease in autocratic areas after Cold War, while the number of civil conflicts remains on a high level in democratic areas. This is probably because newly democratized countries have unstable political environment after social upheaval and need time for accomodations and adjustments. Democracy might lead to peace in the long-term, but in the short-term, it would cause social instability, just as other drastic changes.

p4v_conflict %>%
  mutate(nborder = as.factor(nborder),
         nborderc = ifelse(nborderc == "0 - 2", "0~2", 
                          ifelse(nborderc == "3 - 5", "3~5", 
                                 ifelse(nborderc == ">5", ">5", NA)))) %>%
  filter(inttot > 0) %>%
  group_by(polity2, nborderc) %>%
  ggplot(aes(x = inttot, y = nborderc)) + 
  geom_density_ridges(aes(fill = nborderc), shape = 19, show.legend = FALSE) + 
  scale_y_discrete(limits = c("0~2","3~5",">5")) + 
  labs(title = "Political Regimes and Interstate Conflicts", 
       subtitle = "In the case of same numbers of border states, autocratic states involved in more interstates conflicts.",
       x = "Conflict Magnitudes", 
       y = "Bordering States", 
       caption = "Source: Center for Systemic Peace") +
   my_custome_theme() +
    scale_fill_manual("In Countries With",
                    values = c("0~2" = "#F3D250", 
                               "3~5" = "#90CCF4",
                               ">5" = "#F78888")) +
  facet_grid(~politic)

There are usually many other reasons behind conflicts, thus further examination is needed to identify the individual impact of political regimes. In this graph, I chose the number of natural border countries as a reference since this factor is usually not correlated with the political regimes but is obviously positive correlated with interstate conflicts.

This graph shows that, generally speaking, in the case of same numbers of border states, states with autocrative political schemes involved in more interstate conflicts compared to democratic states. Conflicts in autocratic states also have higher magnitudes, especially in the category of “3~5 Bordering States”. When number of bordering states climbs to above 5, the difference between autocratic and democratic states becomes less significant. As number of bordering states becomes the predominant effect, democratic states in thie level also have more severe conflicts. When the number of bordering states drop to below 2, the difference between the two types of states is also less marked. Democratic countries even have more conflicts with magnitudes higher than 2.5 on record. This is probably because the United States and the United Kingdoms, who traditionally play active and interventionist role in international affairs,fall in this category.

In conclusion, autocratic states tend to take more violent and aggresive actions when confronted with interstate disputes. Beside that, the number of bordering states also play an important role in the brewing of interstate conflicts, especially when having more than 5 neighboring states.

p4v_conflict %>%
  filter(civtot > 0) %>%
  ggplot(aes(x = ethnicc, y = civtot)) + 
  geom_col(aes(fill = ethnicc), size = 4, show.legend = FALSE) +
  scale_x_discrete(limits = c('Non', "Minor", "Major")) +
  labs(title = "Political Regimes and Civil Conflicts", 
       subtitle = "Autocratic states tend to have more severe civil conflicts, even in states without severe ethnic conflicts.",
       x = "Ethnic Conflicts", 
       y = "Total Conflict Magnitudes", 
       caption = "Source: Center for Systemic Peace") +
 my_custome_theme() +
    scale_fill_manual("Ethnic Conflicts",
                    values = c("Major" = "#F3D250", 
                               "Minor" = "#90CCF4",
                               "Non" = "#F78888")) +
  facet_grid(~ politic)

Ethnical conflicts are often the most important cause of civil conflicts. Similar to border countries, ethnical diversity within a country is usually naturally-formed, making it a comparatively independent variable from political regimes. Although people might think that ethnical conflicts are less intensive in democratic countries because of negotiation schemes, it is often not true because in many situations, different ethnic groups don’t have equal representations in the government. As the largest democratic country, India has serious ethnical conflicts. Taking all considerations above, I believe ethnical conflict level is another helpful instrumental variable in the analysis of the individual impacts of political regimes.

The graph above shows that there are significantly more severe civil conflicts in autocratic states than in democratic states. Additionally, most civil conflicts happened in states with ethnical conflicts, which further validates the present conclusion that ethnical conflicts often lead to severe civil conflicts. However, in democratic states, about 70% civil conflicts happened in states with minor or major ethnical conflicts, while in autocratic states, almost one half of civil conflicts happened in states without ethnical conflicts. In other words, ethnical conflicts play a less important role in the eruption of civil conflicts in autocratic states. There are other more significant reasons causing civil conflicts. These reasons, which might include political repressions, are possibly associated with autocratic political schemes.

pop <- p4v_2017[c(5,14)]
p4v_conflict_pop <- merge(pop, p4v_conflict, by = "country")

p4v_conflict_pop %>% 
  filter(conflict > 0) %>%
  mutate(population = ifelse(population == "300-1000"|population == "> 1000", 
                             ">300", population),
         conflict_mean = ifelse(politic == "Autocratic States", conflict/756, conflict/626)) %>%
  ggplot(aes(x = population, y = conflict_mean)) + 
  geom_col(fill = "#00887A", show.legend = FALSE) +
  facet_grid(~politic) + 
  scale_x_discrete(limits = c("< 10","10-30",
                                      "30-50", "50-70",
                                      "70-100", "100-300",
                                      ">300")) +
   my_custome_theme() +
  labs(title = "Political Regimes and Violent Conflicts", 
       subtitle = "Conflict Magnitude is the indicator of Conflict Casualties. Autocratic states tend to have more \n intensified violent conflicts, which produced high casulties even in states with small populations.",
       x = "Population (Millions)", 
       y = "Average Conflict Magnitudes", 
       caption = "Source: Center for Systemic Peace & World Bank") 

Given the fact that CSP’s Conflict Magnitude is based on casulties in each conflict episode, I consider population is also an useful instrumental variable for this analysis. Firstly, population is at least not directly associated with political regimes. Secondly, population is related to conflict magnitudes. It is not hard to imagine that populous states suffer greater casualities than underpopulated states.

From the above graph, it is clearly to see that autocratic states have higher conflict magnitudes than democratic states in general, which aligns with our previous conclusions. Additionally, in autocratic areas, the deadliest conflicts occured in states with comparatively small population (below 50 Million). If the previous assumption that population is positively correlated with conflict magnitude is true, then political regime is very likely to have huge individual impacts on all kinds of violent conflicts.

af_data <- world %>% 
  filter(country == 'Afghanistan'| country == "Pakistan") %>%
  filter(side_a != 'Government of Iraq'  & side_a != 'Hizb-i Islami-yi Afghanistan' & side_a != "Jam'iyyat-i Islami-yi Afghanistan" & side_a != "TTP-KM" & side_a != "BLA" & side_a != "LeJ" & side_a != "TTP" & side_a != "Government of India") %>%
  mutate(side_a = fct_collapse(side_a, 
                               "Afghanistan Govt" = "Government of Afghanistan",
                               "U.S. Govt" = "Government of United States of America",
                               "Pakistan Govt" = "Government of Pakistan",
                               "IS" = "Islamic State",
                               "Taleban" = "Taleban")) 


register_google(key = "AIzaSyB8K3buCHUihhHZnm5ZRJbVjgP-6Z2sJQg")
af_loc <- get_map("Afghanistan", zoom = 6, maptype = "toner", color = "bw")

af_shp <- readOGR(".", "admin2_poly_32")
## OGR data source with driver: ESRI Shapefile 
## Source: "/Users/yinzhantang/Desktop/DataVisz/Political-Regimes-and-Global-Conflict-master", layer: "admin2_poly_32"
## with 32 features
## It has 5 fields
## Integer64 fields read as strings:  PRV32_ID
proj4string(af_shp) <- CRS("+proj=longlat +datum=WGS84")
af_shp <- spTransform(af_shp, CRS("+proj=longlat +datum=WGS84"))
af_shp <- fortify(af_shp, region = "PRV_NAME")

af_shp <- mutate(af_shp, id = tolower(id))
af_region <- af_data %>% 
  mutate(adm_1 = str_remove(adm_1, " province")) %>%
  mutate(adm_1 = tolower(adm_1)) %>% 
  group_by(adm_1) %>%
  summarise(death = sum(best))

af_shp <- af_shp %>% left_join(af_region, by = c("id" = "adm_1"))

af_shp <- mutate(af_shp, deaths = ifelse(death < 300, "300<",
                                 ifelse(death > 300 & death < 600, "300~600", 
                                        ifelse(death > 600 & death < 900, "600~900", 
                                               ifelse(death > 900 & death < 2000, "900~2000", ">2000")))))
                                                           

af_shp$deaths <- factor(af_shp$deaths, levels = c(">2000","900~2000", "600~900","300~600","300<"))

af_map_2 <- ggmap(af_loc)  +
  geom_polygon(aes(x=long, y=lat, group=group, fill=deaths), size=.2, color=1, data=af_shp, alpha=1) + 
  scale_fill_manual("Total Casualties \n(Civilians incl.)",
                   values = c("300<" = "#D4A59A" ,
                              "300~600" = "#C96567",
                              "600~900" = "#9E5A63",
                              "900~2000" = "#644E5B",
                              ">2000"= "#314455")) + 
  geom_point(data = af_data, aes(longitude, latitude, size = best), color = "#67000d") + 
  my_custome_theme() + theme(
    plot.title = element_text(size = 40),
    plot.subtitle = element_text(size = 35),
    legend.position = c(0.8,0.2),
    axis.text.x = element_blank(),
    axis.text.y = element_blank(),
    plot.background = element_blank(),
    legend.text = element_text(size = 20),
    legend.title = element_text(size = 20)
  ) + 
   labs(x = NULL, 
       y = NULL, 
       title = "Conflict Casualties in Afghanistan 2017",
       subtitle = "Conflicts and casualties concentrated in southern border regions.",
        caption = "Source: UCPD Conflicts Data",
       color = "Killed in Action")+
  guides(size = guide_legend("Killed in Action"))
  

  
af_map_2

In 2017, violent conflicts were still prevalent in Afghanistan especially in its mountainous border regions. Casualties numbered in thousands. Most attacks were launched by Afghanistan government who was determined in eliminating Taliban and reunited the country.